import time
import machine

def distance(trig_pin, echo_pin,trig_time=11,temperature=23):
    trig_pin.low()
    time.sleep(1)
    speed = 331.45+0.607*temperature
    trig_pin.high()
    time.sleep_us(trig_time)
    trig_pin.low()
    pt=machine.time_pulse_us(echo_pin, 1, 500*2*30)
    print("pt[%s]us" ,pt)
    return speed*pt/2000
    
